import socket

IP = '127.0.0.1'
PORT = 8888
address = (IP,PORT)
cli = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
cli.connect(address)

cli.send('哈哈'.encode('utf8'))
msg = cli.recv(1024)
print(msg.decode('utf8'))
cli.close()